transformers examplesの文書分類のrun_glue.pyを動かすための環境構築
examples下のスクリプトを手に入れるためにgit clone
Colabで実施するときはcdして&&でつなぐ必要があった
code:setup.ipynb
# transformersのリポジトリのsetup.pyに定義された依存関係のインストール
# 日本語を扱う場合があるので、fugashiなどの依存関係込みでインストール
!git clone https://github.com/huggingface/transformers.git
!cd transformers && pip install .ja
# text-classificationのexamplesを動かすのに必要な依存関係のインストール
!cd transformers/examples/pytorch/text-classification/ && pip install -r requirements.txt
# ヘルプメッセージを表示して動作確認
!cd transformers/examples/pytorch/text-classification/ && python run_glue.py -h
[ja]を指定しないと、日本語のfoundation modelを使おうとしたときに
ModuleNotFoundError: You need to install fugashi to use MecabTokenizer. See https://pypi.org/project/fugashi/ for installation.